package com.thinkgem.jeesite.modules.greatmom.rest;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.modules.greatmom.vo.UserInfo;
import com.thinkgem.jeesite.modules.test.entity.TestData;
import com.thinkgem.jeesite.modules.test.service.TestDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
@RequestMapping(value = "${restPath}/user")
public class RestFulUserController {

    @Autowired
    TestDataService testDataService;

    @RequestMapping(value = "login")
    @ResponseBody
    public UserInfo login(HttpServletRequest request, HttpServletResponse response) {
        UserInfo userInfo = new UserInfo();
        userInfo.setName("小锅子");
        Page<TestData> data = testDataService.findPage(new Page<TestData>(request, response),new TestData());
        List<TestData> datas = data.getList();
        return userInfo;
    }
}



